package net1;

import java.io.IOException;
import java.net.*;

public class UdpClient {
    // 服务端socket地址，包含域名或IP，及端口号
    private static final SocketAddress address = new InetSocketAddress("127.0.0.1", 8888);

    public static void main(String[] args) throws IOException {
        DatagramSocket socket = new DatagramSocket();
        byte[] bytes = "Hello i am client".getBytes();
        DatagramPacket packet = new DatagramPacket(bytes, bytes.length, address);
        socket.send(packet);
    }
}
